package test1.practice;

import java.util.Random;
import java.util.Scanner;

public class MathCalc {
    public static void main(String[] args) {
        int count=0;
    Random r=new Random();
    int number= r.nextInt(100)+1;
        Scanner sc=new Scanner(System.in);
        while(true){
            System.out.println("请输入猜的数字");
            int guessNumber= sc.nextInt();
            count++;
            if (count==30){
                System.out.println("猜中了");
                break;
            }
        if (guessNumber<number){
            System.out.println("小了");
        } else if (guessNumber>number){
            System.out.println("大了");
        }else {
            System.out.println("猜中了");
            break;
        }
    }
}
}

